-- card: 6278 from stack: in.3 -- bmap block id: 7520 -- flags: 4000 -- background id: 8327 -- name: XScrollBoxF ----- HyperTalk script ----- on Install get ChooseTargetStack() InstallResource XFCN,XScrollBoxF,it InstallResource DITL,XScrollBoxF,it InstallResource DLOG,XScrollBoxF,it end Install -- part 2 (field) -- low flags: 01 -- high flags: 4007 -- rect: left=389 top=163 right=286 bottom=489 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: scroller -- part 5 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=18 top=32 right=286 bottom=384 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Documentation -- part 8 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=388 top=49 right=141 bottom=488 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: fonts -- part 9 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=76 top=298 right=320 bottom=176 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: XScrollBoxF ----- HyperTalk script ----- on mouseUp put XScrollBox(4,"Choose Font for Stuff List:",card field "fonts", "Help") into f if f is "Help" then doHelp exit mouseUp else if f is empty or f is "cancel" then exit mouseUp else put item 2 of f into f get XScrollBoxF("c","Choose some stuff:",card field "scroller","",f) if it is empty then exit mouseUp go this card answer "Selection was:"&&it end if end mouseUp on doHelp put "Choose a font to use in displaying the test field." end doHelp -- part contents for card part 5 ----- text ----- XScrollBoxF version 2.4 Roger Brown XScrollBoxF is a version of XScrollBox that allows the selection list to be presented in a font other than the system font. For example, this is being used to create an index to Greek literary references using a Greek font. All specifications are the same as for XScrollBox except for an additional input parameter: the name of the font to use. The named font must be available from the system or the stack and the font size will always be 12. The return value has two items: the number of the selection and the text of the selection. These are separated by commas as in normal HyperCard format. Selection can be made by : 1. double-clicking on a line. 2. single-clicking on a line, then pressing the OK button. 3. single-clicking on a line, then pressing the Return key. 4. typing the first letter(s) of a selection, then doing 1,2, or 3. (Note: type selection assumes that the lines are ordered alphabetically) 5. scrolling with up and down arrow keys, then doing 1,2 or 3. If the Cancel button is pressed, the string "Cancel" is returned. It requires that the DITL and DLOG resources (1346) packaged with it are in the stack. The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a Mac+ screen. INVOKING XScrollBoxF get XScrollBoxF(first,prompt,container,userButton,font) where first is a default selection in the list - either a number or a text string (0 if none). prompt is a string to prompt the user. This appears at the top of the dialog box. container is any hypercard container (field, variable), presumed to be multi-lined. UserButton is the name for an optional author specified button. If this button is pressed, its name is returned further processing by the script. Font is the name of the font to use. EXAMPLE ex. get XScrollBoxF(1,"Choose:",card field 1,"Help","cartoon") if OK is pressed, returns : 1,text of line 1 of card field 1 REVISION HISTORY 1.1 center dialog box on any size screen 1.2 - add selection scrolling by typing and by cursor keys 1.3 - add text of chosen item to return value 1.4 - 3/2/88 add optional user button 1.6 - fixed some selection by typing problems 1.7 - LSC 3.0 compatible. Fixed problem of a bomb if the font is not specified. 2.0 - 9/9/89 SuperCard compatible, fixed bugs in typing-selection, and userButton string handling. First item is selected if there is no default and the user presses a cursor arrow key. One source for all 3 versions, control version with compiler variables. Compiles under THINK C ™ 4.0. 2.1 - 2/21/90 Puch of cancel button now returns "Cancel" string. Fixed some bugs in allocatin and use of return handle. 2.2 - 3/29/90 Correctly displays eight-bit characters. 2.3 - 3/30/90 added XScrollBoxML variation 2.4 - 4/17/90 revived a feature that had disappeared: specifying the default selection in XScrollBox and XScrollBox F as a string rather than a number -- part contents for card part 8 ----- text ----- Chicago Courier Geneva Helvetica Monaco New York Doesn't Exist -- part contents for card part 2 ----- text ----- able baker charlie dog ernest fox gamma horse ice cream jumping jack flash knockwurst liver monkey no way, jose occularity penelope qwerty rapscallion salubrious twinkle toes underwhelmed vermin wascally wabbit yokel zenzational